/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface Poorder extends BasicModel<Poorder> {
  pkCorp?: string; // 公司主键
  unitname?: string; // 公司名称
  vordercode?: string; // 订单编号
  nversion?: number; // 版本号
  dorderdate?: string; // 订单日期
  cbiztype?: string; // 业务流程主键
  businame?: string; // 业务流程
  pkPurorg?: string; // 采购组织主键
  puname?: string; // 采购组织名称
  pkCubasdoc?: string; // 供应商主键
  custName?: string; // 供应商名称
  ntotalnum?: number; // 合计数量
  pkPsndoc?: string; // 采购员主键
  psnName?: string; // 采购员名称
  pkDeptdoc?: string; // 采购部门编码主键
  deptName?: string; // 采购部门名称
  createByName?: string; // 制单人名称
  updateByName?: string; // 修改人名称
  auditBy?: string; // 审核人
  auditByName?: string; // 审核人名称
  auditDate?: string; // 审核时间
  orderStatus?: number; // 订单状态
  bislatest?: string; // 是否最新版本
  dr?: number; // 删除标志
  poorderBList?: any[]; // 子表列表
}

export interface PoorderB extends BasicModel<PoorderB> {
  parentId?: string; // 订单主键
  crowno?: string; // 行号
  cinvcode?: string; // 存货编码
  cinvname?: string; // 存货名称
  cinvspec?: string; // 规格
  cinvtype?: string; // 型号
  measname?: string; // 计量单位
  nordernum?: number; // 数量
  dplanarrvdate?: string; // 计划到货日期
}

export const poorderList = (params?: Poorder | any) =>
  defHttp.get<Poorder>({ url: adminPath + '/puorder/poorder/list', params });

export const poorderListData = (params?: Poorder | any) =>
  defHttp.post<Page<Poorder>>({ url: adminPath + '/puorder/poorder/listData', params });

export const chgHistoryListData = (params?: Poorder | any) =>
  defHttp.post<Page<Poorder>>({ url: adminPath + '/puorder/poorder/chgHistoryListData', params });

// export const chgHistoryBListData = (params?: Poorder | any) =>
//   defHttp.post<Page<Poorder>>({ url: adminPath + '/puorder/poorder/chgHistoryBListData', params });


export const needComfirmListData = (params?: Poorder | any) =>
  defHttp.post<Page<Poorder>>({ url: adminPath + '/puorder/poorder/needComfirmListData', params });


export const poorderForm = (params?: Poorder | any) =>
  defHttp.get<Poorder>({ url: adminPath + '/puorder/poorder/form', params });

export const poorderSave = (params?: any, data?: Poorder | any) =>
  defHttp.postJson<Poorder>({ url: adminPath + '/puorder/poorder/save', params, data });

export const poorderDelete = (params?: Poorder | any) =>
  defHttp.get<Poorder>({ url: adminPath + '/puorder/poorder/delete', params });

export const poorderComfirm = (params?: Poorder | any) =>
  defHttp.get<Poorder>({ url: adminPath + '/puorder/poorder/comfirm', params });

export const poorderBListData = (params?: PoorderB | any) =>
  defHttp.get<PoorderB>({ url: adminPath + '/puorder/poorder/poorderBListData', params });

export const findChildByIdData = (params?: PoorderB | any) =>
  defHttp.get<PoorderB>({ url: adminPath + '/puorder/poorder/findChildByIdData', params });
